<template>
	<view class="shopping">
		<view class="shop-list" @click="toDetail(item.id)" v-for="item in shoppingList" :key="item.id">
			<image :src="item.image" mode=""></image>
			<view class="shop-content">
				<button class="shop-btn" @click.stop="toPhone(item.phone)">
					拨打电话
				</button>
				<view class="shop-title">
					{{item.title}}
				</view>
				<view class="shop-sub">
					<uv-icon name="phone" size="16"></uv-icon>
					<view class="shop-sub-title">
						{{item.phone}}
					</view>
				</view>
				<view class="shop-sub">
					<uv-icon name="map" size="16"></uv-icon>
					<view class="shop-sub-title1">
						{{item.floor}}
					</view>
				</view>
				<view class="shop-adress">
					{{item.address}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		ShoppingList
	} from '../../api/list.js'
	export default {
		data() {
			return {
				page: 1,
				limit: 5,
				shoppingList: []
			}
		},
		created() {
			this.getShopping()
		},
		methods: {
			toDetail(id) {
				let url = '../../subcontract/shoppingDetail/index?id=' + id
				uni.navigateTo({
					url: url
				})
			},
			async getShopping() {
				const {
					data
				} = await ShoppingList()
				console.log(data.data)
				this.shoppingList = data.data
			},
			toPhone(phone) {
				uni.makePhoneCall({
					phoneNumber: phone //仅为示例
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	@font-face {
		font-family: 'PingFang SC';
		src: url('../../static/font/PingFang Regular.ttf');
	}

	.shopping {
		width: 750rpx;
		// height: 1322rpx;
		background: #FFFFFF;
		border-radius: 12rpx;
		margin-top: 48rpx;
		// display: flex;
		// justify-content: center;
		padding-top: 48rpx;
		box-sizing: border-box;
		padding-left: 28rpx;
		padding-right: 28rpx;

		.shop-list {
			width: 694rpx;
			height: 578rpx;
			border-radius: 0rpx 0rpx 16rpx 16rpx;
			border: 2rpx solid #EAE5F0;
			margin-bottom: 20rpx;

			image {
				width: 694rpx;
				height: 330rpx;
				border-radius: 16rpx 16rpx 0rpx 0rpx;
			}

			.shop-content {
				width: 694rpx;
				height: 330rpx;
				border-radius: 16rpx 16rpx 0rpx 0rpx;
				position: relative;
				padding-left: 18rpx;
				box-sizing: border-box;

				.shop-btn {
					// width: 136rpx;
					height: 60rpx;
					background: #04B364;
					border-radius: 12rpx;
					font-size: 24rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
					display: flex;
					align-items: center;
					justify-content: center;
					position: absolute;
					right: 34rpx;
					top: 20rpx;
				}

				.shop-title {
					height: 42rpx;
					font-size: 34rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					color: #333333;
					margin-top: 16rpx;
				}

				.shop-sub {
					margin-top: 18rpx;
					display: flex;

					.shop-sub-title {
						margin-left: 8rpx;
						font-size: 30rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 500;
						color: #666666;
					}

					.shop-sub-title1 {
						margin-left: 8rpx;
						font-size: 30rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #333333;
					}
				}

				.shop-adress {
					margin-left: 36rpx;
					height: 34rpx;
					font-size: 30rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #999999;
					margin-top: 10rpx;
				}

			}
		}
	}
</style>